#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int k = 0;
    while (scanf("%d", &k) != EOF)
    {
        int i = 0;
        for (i = 0; i < k; i++)
        {
            for (int j = 0; j < k; j++)
            {
                if (i == 0 || i == k - 1)
                {
                    printf("* ");
                }
                else if (j == 0 || j == k - 1)
                {
                    printf("* ");
                }
                else printf("  ");
            }printf("\n");
        }
    }
    return 0;
}